import pymysql
# 调用env.py文件中的变量连接数据库
from env import MYSQL_HOST
from env import MYSQL_DATABASE
from env import MYSQL_PASSWORD
from env import MYSQL_USERNAME

MYSQL_HOST = MYSQL_HOST
MYSQL_DATABASE = MYSQL_DATABASE
MYSQL_USERNAME = MYSQL_USERNAME
MYSQL_PASSWORD = MYSQL_PASSWORD
db = pymysql.connect(host=MYSQL_HOST,
                     user=MYSQL_USERNAME,
                     password=MYSQL_PASSWORD,
                     database=MYSQL_DATABASE)
cursor = db.cursor()
result = cursor.execute("delete from user where 1 = 1")
print(result)
db.commit()

cursor.close()
db.close()